home *** CD-ROM | disk | other *** search
/ SGI Hot Mix 8 / Hot Mix 8.iso / .all / demos / Z-Mail / RemoveIt2 (.txt) < prev   
Text File  |  1994-06-22  |  3KB  |  117 lines

  1. #!/bin/csh -f
  2.  
  3. #  This script will remove the INST_PATH directory created by the
  4. #  InstallIt2 script.
  5.  
  6. switch ( `uname -r` )
  7. case 5* :
  8.     set INST_DIR=zmail.sgi5
  9.     breaksw
  10. default :
  11.     set INST_DIR=zmail.sgi
  12.     breaksw
  13. endsw
  14.  
  15. #  Determine INST_PATH from the HOTMIXPATH* file.
  16. #
  17. #  First, try /usr/tmp.  If not there, try the user's home directory,
  18. #  and finally, /tmp.  If not in any of these places, ask for the
  19. #  name of the path.  If the user doesn't know (or forgets) where
  20. #  the software was installed, we're SOL.  Remove the file after
  21. #  using it.
  22.  
  23. if ( -r /usr/tmp/HOTMIXPATH_$INST_DIR ) then
  24.     source /usr/tmp/HOTMIXPATH_$INST_DIR
  25.     sleep 2
  26. else if ( -r ~/HOTMIXPATH_$INST_DIR ) then
  27.     source ~/HOTMIXPATH_$INST_DIR
  28.     sleep 2
  29. else if ( -r /tmp/HOTMIXPATH_$INST_DIR ) then
  30.     source /tmp/HOTMIXPATH_$INST_DIR
  31.     sleep 2
  32. else
  33.     LOOP1:
  34.     echo " "
  35.     echo "Enter the full path name of the directory"
  36.     echo "where the demo is installed (or 'q' to quit):  \c"
  37.     set INST_PATH=($<)
  38.     if ( $#INST_PATH == 0 ) then
  39.         echo " "
  40.         echo "Input error.  Please try again."
  41.         goto LOOP1
  42.     else if ( $INST_PATH == 'q' ) then
  43.         echo " "
  44.         echo "... Bye."
  45.         sleep 3
  46.         exit
  47.     endif
  48. endif
  49.  
  50. #  Remove the installation directory.
  51.  
  52. if ( -r $INST_PATH ) then
  53.  
  54.     if ( -w $INST_PATH ) then
  55.  
  56.         echo " "
  57.         echo "About to remove the entire $INST_PATH directory."
  58.         echo "Is this OK (y/n)?  \c"
  59.         set ans=($<)
  60.         if ( $ans == 'y' ) then
  61.             echo " "
  62.             echo "Removing $INST_PATH.  Please wait..."
  63.  
  64.             /bin/rm -rf $INST_PATH
  65.  
  66.             /bin/rm -f /usr/tmp/HOTMIXPATH_$INST_DIR > /dev/null
  67.             /bin/rm -f ~/HOTMIXPATH_$INST_DIR > /dev/null
  68.             /bin/rm -f /tmp/HOTMIXPATH_$INST_DIR > /dev/null
  69.  
  70.             echo " "
  71.             echo "Removal complete."
  72.             sleep 3
  73.             exit
  74.         else 
  75.             echo "... Bye."
  76.             sleep 3
  77.             exit
  78.         endif
  79.  
  80.     else
  81.         echo " "
  82.         echo "You do not have permission to remove the $INST_PATH directory."
  83.         echo "If you are SURE you want to remove this, you will be asked"
  84.         echo "for the root password before proceeding."
  85.         echo " "
  86.         echo "Continue (y/n)?  \c"
  87.         set ans=($<)
  88.         if ( $ans == 'y' ) then
  89.             echo " "
  90.             echo "Removing $INST_PATH.  Please wait..."
  91.  
  92.             su - root -c "/bin/rm -rf $INST_PATH"
  93.  
  94.             echo " "
  95.             echo "Removal complete."
  96.             sleep 3
  97.             exit
  98.         else
  99.             echo " "
  100.             echo "... Bye."
  101.             sleep 3
  102.             exit
  103.         endif
  104.     endif
  105. else
  106.         echo " "
  107.         echo "Could not find the $INST_PATH directory.  Please try again."
  108.         echo " "
  109.         echo "... Bye."
  110.         /bin/rm -f /usr/tmp/HOTMIXPATH_$INST_DIR > /dev/null
  111.         /bin/rm -f ~/HOTMIXPATH_$INST_DIR > /dev/null
  112.         /bin/rm -f /tmp/HOTMIXPATH_$INST_DIR > /dev/null
  113.         sleep 10
  114. endif
  115.  
  116. exit 0
  117.